hbridge18 2.2.1
Loading...
Searching...
No Matches
H-Bridge 18 Click Driver

API for configuring and manipulating H-Bridge 18 Click driver. More...

Topics

 H-Bridge 18 Registers List
 List of registers of H-Bridge 18 Click driver.
 H-Bridge 18 Registers Settings
 Settings for registers of H-Bridge 18 Click driver.
 H-Bridge 18 MikroBUS Map
 MikroBUS pin mapping of H-Bridge 18 Click driver.

Functions

void hbridge18_cfg_setup (hbridge18_cfg_t *cfg)
 H-Bridge 18 configuration object setup function.
err_t hbridge18_init (hbridge18_t *ctx, hbridge18_cfg_t *cfg)
 H-Bridge 18 initialization function.
err_t hbridge18_default_cfg (hbridge18_t *ctx)
 H-Bridge 18 default configuration function.
err_t hbridge18_write_reg (hbridge18_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 18 write register function.
err_t hbridge18_read_reg (hbridge18_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 18 read register function.
void hbridge18_enable_device (hbridge18_t *ctx)
 H-Bridge 18 enable device function.
void hbridge18_disable_device (hbridge18_t *ctx)
 H-Bridge 18 disable device function.
uint8_t hbridge18_get_fault_pin (hbridge18_t *ctx)
 H-Bridge 18 get fault pin function.
err_t hbridge18_check_communication (hbridge18_t *ctx)
 H-Bridge 18 check communication function.
err_t hbridge18_set_motor_state (hbridge18_t *ctx, uint8_t motor, uint8_t state)
 H-Bridge 18 set motor state function.

Detailed Description

API for configuring and manipulating H-Bridge 18 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ hbridge18_cfg_setup()

void hbridge18_cfg_setup ( hbridge18_cfg_t * cfg)

H-Bridge 18 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See hbridge18_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ hbridge18_check_communication()

err_t hbridge18_check_communication ( hbridge18_t * ctx)

H-Bridge 18 check communication function.

This function checks communication with the device by reading and verifying the configuration register.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
Returns
  • 0 - Success (Device ID matches),
  • -1 - Error (Device ID mismatch or communication failure).
Note
None.

◆ hbridge18_default_cfg()

err_t hbridge18_default_cfg ( hbridge18_t * ctx)

H-Bridge 18 default configuration function.

This function executes a default configuration of H-Bridge 18 Click board.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ hbridge18_disable_device()

void hbridge18_disable_device ( hbridge18_t * ctx)

H-Bridge 18 disable device function.

This function disables the H-Bridge 18 device by setting the sleep pin low.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ hbridge18_enable_device()

void hbridge18_enable_device ( hbridge18_t * ctx)

H-Bridge 18 enable device function.

This function enables the H-Bridge 18 device by setting the sleep pin high.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ hbridge18_get_fault_pin()

uint8_t hbridge18_get_fault_pin ( hbridge18_t * ctx)

H-Bridge 18 get fault pin function.

This function reads the fault pin logic state.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ hbridge18_init()

err_t hbridge18_init ( hbridge18_t * ctx,
hbridge18_cfg_t * cfg )

H-Bridge 18 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See hbridge18_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge18_read_reg()

err_t hbridge18_read_reg ( hbridge18_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 18 read register function.

This function reads a byte of data from the specified register using the SPI interface.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to store the read data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ hbridge18_set_motor_state()

err_t hbridge18_set_motor_state ( hbridge18_t * ctx,
uint8_t motor,
uint8_t state )

H-Bridge 18 set motor state function.

This function sets the motor state for the selected motor (coast, forward, reverse, brake low-side, or brake high-side).

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
[in]motor: Motor selection.
  • 0: Motor 0 (connected between O1-O2),
  • 1: Motor 1 (connected between O3-O4).
[in]state: Motor state selection.
  • 0: Coast,
  • 1: Forward,
  • 2: Reverse,
  • 3: Brake low-side,
  • 4: Brake high-side.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ hbridge18_write_reg()

err_t hbridge18_write_reg ( hbridge18_t * ctx,
uint8_t reg,
uint8_t data_in )

H-Bridge 18 write register function.

This function writes a byte of data to the specified register using the SPI interface.

Parameters
[in]ctx: Click context object. See hbridge18_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written to the register.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.